home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / utils / scrldlg.arj / MAIN.CPP < prev    next >
C/C++ Source or Header  |  1993-09-16  |  1KB  |  67 lines

  1. /*
  2.  
  3. Author:    Patrick Reilly
  4. Date:      9/16/93
  5.  
  6.     This is a demo program to demonstrate using the ScrollDialog (and
  7. ScrollGroup) classes. Released to the public domain. Use at your own risk <g>.
  8.  
  9. */
  10.  
  11. #define Uses_ScrollDialog
  12.     #define Uses_TDialog
  13. #define Uses_ScrollGroup
  14.     #define Uses_TGroup
  15.  
  16. #define Uses_TStaticText
  17. #define Uses_TInputLine
  18. #define Uses_TApplication
  19. #define Uses_TDeskTop
  20. #include <tv.h>
  21.     #include "Dlg.h"
  22.  
  23. class TApp : public TApplication
  24. {
  25. public:
  26.  
  27.     TApp();
  28. };
  29.  
  30. static char ctrlString[] = "Control 01";
  31.  
  32. TApp::TApp() : TProgInit(initStatusLine, initMenuBar, initDeskTop)
  33. {
  34.     ScrollDialog* dlg = new ScrollDialog(TRect(0,0,40,10), "Test Dialog", sbVertical);
  35.     dlg->options |= ofCentered;
  36.     dlg->flags |= wfGrow;
  37.  
  38.     for(int x = 0; x < 40; x++)
  39.         {
  40.         if(x%10)
  41.             {
  42.             int n = x+1;
  43.             ctrlString[8] = '0' + (n/10);
  44.             ctrlString[9] = '0' + (n%10);
  45.             dlg->scrollGroup->insert(new TStaticText(TRect(0,x,10,x+1), ctrlString));
  46.             }
  47.         else
  48.             dlg->scrollGroup->insert(new TInputLine(TRect(0,x,10,x+1), 20));
  49.         }
  50.     dlg->scrollGroup->selectNext(False);
  51.     dlg->scrollGroup->setLimit(0, 40);
  52.  
  53.     if(validView(dlg) != 0)
  54.         {
  55.         deskTop->execView(dlg);
  56.         destroy(dlg);
  57.         }
  58. }
  59.  
  60. int main()
  61. {
  62.     TApp app;
  63.     app.run();
  64.     app.shutDown();
  65.     return 0;
  66. }
  67.